package jp.sourceforge.akjrcp.text_douga.audio;

import java.io.IOException;
import java.io.OutputStream;

import jp.sourceforge.akjrcp.text_douga.AudioData;
import jp.sourceforge.akjrcp.text_douga.DougaPreference;

public class ZeroAudioData implements AudioData{
private boolean fitLogicalLength;
private double logicalLength;
private double duration;
	public double getDuration() {
	return duration;
}

public void setDuration(double duration) {
	this.duration = duration;
}

public boolean isFitLogicalLength() {
	return fitLogicalLength;
}

public double getLogicalLength() {
	return logicalLength;
}

	public void setSynch(boolean fitLogicalLength) {
		this.fitLogicalLength=fitLogicalLength;
	}

	public void setSynchLength(double logicalLength) {
		this.logicalLength=logicalLength;
	}

	public long writeData(DougaPreference preference, OutputStream outputStream, long maxbytes) throws IOException {
		double d=duration;
		if(fitLogicalLength){
			d=logicalLength;
		}
		if(d>0){
			return AudioUtils.writeZero(outputStream, d, preference.getAudioRate(), preference.getAudioChannel());
		}
		return 0;
	}

	public double getTotalTime() {
		return duration;
	}

}
